MODULE := lua_f_io_base.so 
MODULE += lua_f_io_client.so 
MODULE += lua_f_buffer.so
MODULE += lua_f_epoll.so
MODULE += lua_f_sock.so
MODULE += lua_f_worker.so

.PHONY : clean all install

CFLAGS += -Wall -g -fPIC -DDEBUG
LDFLAGS += lua_f_base.o -llua -lcutils

INSTALL= install -p
INSTALL_SO= $(INSTALL) -m 0644
LUA_CLIB_PATH=/usr/local/lib/lua/5.1

all: lua_f_base.o ${MODULE}
	@echo "compile ${MODULE} done!"

install:
	$(INSTALL_SO) *.so $(LUA_CLIB_PATH)

%.so : %.o
	@$(CC) --shared -o $@ $^ $(LDFLAGS)
	@mv $@ $(subst lua_f_,,$@)

%.o : %.c
	$(CC) $(CFLAGS) -c $^

clean:
	$(RM) *.o $(MODULE) *.so
